package final2107.day11;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class StudentTest {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
//        Student student = new Student(101,"jack");
//        ObjectOutputStream oos = new ObjectOutputStream(
//                new FileOutputStream("stu.txt"));
//
//        oos.writeObject(student);
//
//        oos.close();

        //读取文件中的对象数据并还原成对象，输出
        ObjectInputStream ois = new ObjectInputStream(
                new FileInputStream("stu.txt"));
        Student student = (Student) ois.readObject();
        System.out.println(student);

        ois.close();
    }
}
